<?php

namespace XYWY\Controller;

/**
 * RepairController类
 *
 * @since 1.0 <2015-10-26> SoChishun <14507247@qq.com> Added.
 */
class RepairController extends AppbaseController {

    function update_news_summary() {
        $news = M('news_table')->where('hit>0')->field('hit,content')->select();
        foreach ($news as $row) {
            $content = strip_tags(html_entity_decode($row['content']));
            $content = str_replace(' ', '', str_replace('&nbsp;', '', $content));
            $content = mb_substr($content, 0, 150, 'utf-8');
            M('t_porg_document')->where('id=' . $row['hit'])->setField('summary', $content);
            echo 'update t_porg_document set summary=\''.$content.'\' where id='.$row['hit'];
            echo '<hr />';
        }
        echo 'ok';
    }

}
